package org.phalanx.messenging;

import java.util.ArrayList;

public class MessageQueue {
	private ArrayList<Messageable> msgQueueList;
	
	public MessageQueue(){
		msgQueueList = new ArrayList<Messageable>();
	}
	
	synchronized public void addMessageToQueue(Messageable msg){
		if (!msgQueueList.contains(msg)){
			msgQueueList.add(msg);
		}
	}
	
	synchronized public void clearMessagesFromQueue(){
		if (!msgQueueList.isEmpty()){
			msgQueueList.clear();
		}
	}
	
	synchronized public ArrayList<Messageable> getQueue(){
		return msgQueueList;
	}
}
